import React, { useMemo } from 'react';

import { Switch } from 'antd';

import { INodeComponent } from './type';

export const NodeBoolean: React.FC<INodeComponent> = (props) => {
  const data = useMemo(() => {
    return props?.data;
  }, [props?.data]);

  const onSwitchChange = (e: any) => {
    let value = e;

    if (props.onChange) {
      props.onChange(value);
    }
  };

  return <Switch checked={props?.value ?? false} onChange={onSwitchChange} />;
};
